package com.leadingsoft.pwxk.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.leadingsoft.pwxk.converter.WaterDrainConverster;
import com.leadingsoft.pwxk.dto.WaterDrainDto;
import com.leadingsoft.pwxk.model.WaterDrain;
import com.leadingsoft.pwxk.model.WaterDrainBaseInfoOne;
import com.leadingsoft.pwxk.model.WaterNorm;
import com.leadingsoft.pwxk.repository.WaterDrainBaseInfoOneRepository;
import com.leadingsoft.pwxk.repository.WaterNormRepository;
import com.leadingsoft.pwxk.service.WaterDrainService;

@Service
public class WaterDrainServiceImpl implements WaterDrainService {

	@Autowired
	private WaterNormRepository waterNormRepository;
	@Autowired
	private WaterDrainBaseInfoOneRepository waterDrainBaseInfoOneRepository;
	@Autowired
	private WaterDrainConverster waterDrainConverster;

	@Override
	public WaterDrainDto get(String dataid) {
		WaterDrain waterDrain = new WaterDrain();
		List<WaterDrainBaseInfoOne> directList = waterDrainBaseInfoOneRepository.findByDataid(dataid);
		List<WaterNorm> waterNorm = waterNormRepository.findByDataid(dataid);
		waterDrain.setDirectList(directList);
		waterDrain.setWaterNorm(waterNorm);
		return waterDrainConverster.toDto(waterDrain);
	}

}
